import java.util.Arrays;

public class Two {
    public int MLS (int[] arr) {
        Arrays.sort(arr);
        int n=arr.length,ret=0;
        for (int i = 0; i < n;) {
            int j=i+1,count=1;
            while (j<n){
                if(arr[j]-arr[j-1]==1){
                    count++;
                    j++;
                } else if (arr[j] - arr[j - 1] == 0) {
                    j++;
                }else {
                    break;
                }
            }
            ret=Math.max(ret,count);
            i=j;
        }
        return ret;
    }
}
